package Song.Han.day02.demo03;
/*
* [1,2,3,4,5] -> [5,4,3,2,1]
* 要求：不能使用新数组*/
public class ArrayReverse {
    public static void main(String[] args) {
        int[] array = {1,2,3,4,5};

        for (int i = 0; i < array.length; i++) {
            System.out.println(array[i]);
        }
        System.out.println("----------------");

        int re;
        int min = 0,max = array.length-1;
        while (min<=max){
            re = array[min];
            array[min] = array[max];
            array[max] = re;
            min++;
            max--;
        }

        for (int i = 0; i < array.length; i++) {
            System.out.println(array[i]);
        }

    }
}
